﻿<UserControl x:Class="Freshome.m.vws.Minoraws"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:v="clr-namespace:Freshome.m.vws"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <UserControl.Resources>
        <v:Bool2Visible x:Key="b2v" />
    </UserControl.Resources>
    <Grid x:Name="topanel">
        <Grid.RowDefinitions>
            <RowDefinition></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition MinWidth="100"></ColumnDefinition>
            <ColumnDefinition Width="Auto"></ColumnDefinition>
            <ColumnDefinition MinWidth="100"></ColumnDefinition>
        </Grid.ColumnDefinitions>
        <GroupBox x:Name="epd" Header="固态佐料">
            <DataGrid x:Name="dgd" ItemsSource="{Binding Path=P_solid}" IsReadOnly="{Binding Readonly}">
                <DataGrid.CommandBindings>
                    <CommandBinding Command="ApplicationCommands.Delete" CanExecute="Minoraw_CanExecute" Executed="Delete_Executed" />
                </DataGrid.CommandBindings>
                <DataGrid.ContextMenu>
                    <ContextMenu Visibility="{Binding Path=Enabled, Converter={StaticResource b2v}}">
                        <MenuItem Header="删除固态佐料" Command="ApplicationCommands.Delete"></MenuItem>
                    </ContextMenu>
                </DataGrid.ContextMenu>
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding Path=Name}" Header="固态佐料名称" 
                                    MinWidth="100" MaxWidth="200" ToolTipService.ToolTip="2 - 10个字符"/>
                    <DataGridTextColumn Binding="{Binding Path=Notes}" Header="固态佐料说明" 
                                    MinWidth="200" MaxWidth="500" ToolTipService.ToolTip="0 - 50个字符"/>
                </DataGrid.Columns>
            </DataGrid>
        </GroupBox>
        <TextBlock Grid.Row="1" Grid.Column="0">菜谱可按主料条目分类，佐料不能用于菜谱分类。</TextBlock>
        <GridSplitter Grid.Row="0" Grid.Column="1" Grid.RowSpan="2" Width="3" VerticalAlignment="Stretch" HorizontalAlignment="Center" ShowsPreview="True"></GridSplitter>
        <GroupBox Grid.Column="2" Header="液态佐料">
            <DataGrid x:Name="dgq" ItemsSource="{Binding Path=P_liquid}" IsReadOnly="{Binding Readonly}">
                <DataGrid.CommandBindings>
                    <CommandBinding Command="ApplicationCommands.Delete" CanExecute="Minoraw_CanExecute" Executed="Delete_Executed"  />
                </DataGrid.CommandBindings>
                <DataGrid.ContextMenu>
                    <ContextMenu Visibility="{Binding Path=Enabled, Converter={StaticResource b2v}}">
                        <MenuItem Header="删除液态佐料" Command="ApplicationCommands.Delete"></MenuItem>
                    </ContextMenu>
                </DataGrid.ContextMenu>
                <DataGrid.Columns>
                    <DataGridTextColumn Binding="{Binding Path=Name}" Header="液态佐料名称"
                                    MinWidth="100" MaxWidth="200" ToolTipService.ToolTip="2 - 10个字符"/>
                    <DataGridTextColumn Binding="{Binding Path=Notes}" Header="液态佐料说明" 
                                    MinWidth="200" MaxWidth="500" ToolTipService.ToolTip="0 - 50个字符"/>
                </DataGrid.Columns>
            </DataGrid>
        </GroupBox>
        <Button Grid.Row="1" Grid.Column="2" Visibility="{Binding Path=Enabled, Converter={StaticResource b2v}}"
                Command="{Binding Path=Save}" Content="{Binding Path=Save.Name}" HorizontalAlignment="Right"></Button>
    </Grid>
</UserControl>
